package com.caregiver.watch.business.care.model.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * @Description:
 * @Author 疆戟
 * @Date 2025/11/2 18:09
 * @Version 1.0
 */
@Data
@Schema(description = "预警次数")
public class AlertCountVo {

    @Schema(description = "总预警数量")
    private Integer totalAlertCount;

    @Schema(description = "预警次数列表")
    private List<AlertCount> alertCounts;


    public static AlertCountVo build(List<AlertCount> alertCounts) {
        AlertCountVo alertCountVo = new AlertCountVo();
        alertCountVo.setAlertCounts(alertCounts);
        alertCountVo.setTotalAlertCount(alertCounts.stream().mapToInt(AlertCount::getAlertCount).sum());
        return alertCountVo;
    }

    @Data
    @Schema(description = "预警次数")
    public static class AlertCount {

        /**
         * 被照护人ID
         */
        @Schema(description = "被照护人ID")
        private Long recipientId;

        /**
         * 被照护人名称
         */
        @Schema(description = "被照护人名称")
        private String recipientName;

        /**
         * 预警次数
         */
        @Schema(description = "预警次数")
        private Integer alertCount;
    }
}
